package queue

import (
	"fmt"
	"log"

	"github.com/streadway/amqp"
)

func HealthCheck() error {
	if Connection == nil || Channel == nil {
		return fmt.Errorf("RabbitMQ connection or channel not initialized")
	}

	if err := Connection.NotifyClose(make(chan *amqp.Error)); err != nil {
		return fmt.Errorf("RabbitMQ health check failed: %w", err)
	}

	log.Println("RabbitMQ health check passed")
	return nil
}
